<script>
import { mapActions, mapMutations, mapState } from 'vuex';
import request from '@/utils/request';
import { basisInformation } from '@/api/user';
export default {
	data() {
		return {
			latitude: '',
			longitude: ''
		};
	},
	onLaunch: function() {
		let _self = this;
		uni.getStorage({
			key: 'userinfo',
			success: function(data) {
				_self.$store.commit('user/LOGIN_INFO', data.data);
			}
		});
		uni.getStorage({
			key: 'userinfo',
			success: function(data) {
				_self.$store.commit('user/Shopping', data.data);
			}
		});

		// 定位储存
		uni.getStorage({
			key: 'MAP',
			success: function(data) {
				_self.$store.commit('user/MAP', data.data);
			}
		});
		uni.getStorage({
			key: 'positioning',
			success: function(data) {
				_self.$store.commit('user/positioning', data.data);
			}
		});
	},
	onShow: function() {
		this.GetLOcation();
		this.init();
	},
	onHide: function() {
		console.log('App Hide');
	},
	mounted() {},

	methods: {
		...mapActions('user', ['LOGIN_INFO', 'Shopping', 'MAP', 'positioning', 'LIST']),
		GetLOcation() {
			var that = this;
			uni.getLocation({
				type: 'gcj02',
				success: res => {
					console.log(res, 8888);
					this.latitude = parseFloat(res.latitude);
					this.longitude = parseFloat(res.longitude);

					this.$store.commit('user/MAP', this.latitude);
					this.$store.commit('user/positioning', this.longitude);
				}
			});
		},
		// 搜索框
		init() {
			var data = [
				[
					{
						title: '搜索框',
						name: 'search',
						styles: {
							colorInput: '#fff',
							colorWord: '#C2C2C2',
							colorBg: '#f7f7f7',
							text: '请输入关键字进行搜索',
							marginTop: 0,
							marginBottom: 0,
							marginLeft: 0,
							marginRight: 0,
							circle: 14,
							wordStatus: 'left'
						}
					},
					{
						title: '固定定位',
						name: 'fixed',
						styles: {
							module: '1',
							orPic: '2',
							marginTop: 0,
							marginBottom: 0,
							marginLeft: 0,
							marginRight: 0,
							colorBg: '#fff',
							colorWord: '#343434',
							circle: 0,
							imgUrl: [
								{
									url: '',
									img: 'https://desk-fd.zol-img.com.cn/t_s960x600c5/g3/M09/0C/02/ChMlV17yBSWISHDdAEzI9S16J58AAVKfgF4BVcATMkN842.jpg'
								},
								{
									img: 'https://desk-fd.zol-img.com.cn/t_s960x600c5/g2/M00/0A/0E/ChMlWV7Nzg2If000AByhT0w4e8UAAPg0ALUWfIAHKFn587.jpg',
									url: ''
								},
								{
									img: 'https://desk-fd.zol-img.com.cn/t_s960x600c5/g2/M00/0A/05/ChMlWV7MdoWIechYAEXkfmcSAKcAAPeggE6JV8AReSW652.jpg',
									url: ''
								}
							],
							upLoad1: {
								text: '',
								img: '',
								url: ''
							},
							upLoad2: {
								text: '',
								img: '',
								url: ''
							}
						}
					},
					{
						title: '公告',
						name: 'notice',
						styles: {
							colorWord: '#212121',
							colorBg: '#fff',
							hand: [
								{
									img: 'https://desk-fd.zol-img.com.cn/t_s960x600c5/g2/M00/0A/05/ChMlWV7MdoWIechYAEXkfmcSAKcAAPeggE6JV8AReSW652.jpg',
									title: '这里是第一条自定义公告标题',
									url: ''
								}
							],
							marginLR: 10,
							marginTop: 6,
							marginBottom: 6
						}
					},
					{
						title: '按钮组',
						name: 'btn',
						styles: {
							line: '2',
							num: '5',
							marginTop: 12,
							marginBottom: 1,
							marginLeft: 0,
							marginRight: 0,
							circle: 0,
							circleBtn: 50,
							colorBg: '#FFFFFF',
							colorWord: '#2c2c2c',
							btnList: [
								{
									img: 'https://desk-fd.zol-img.com.cn/t_s960x600c5/g2/M00/0A/05/ChMlWl7MdmmICelhACSK0jeJsqoAAPegAK1X00AJIrq397.jpg',
									word: '充值返现',
									url: ''
								},
								{
									img: 'https://desk-fd.zol-img.com.cn/t_s960x600c5/g3/M09/0C/02/ChMlV17yBSWISHDdAEzI9S16J58AAVKfgF4BVcATMkN842.jpg',
									word: '领优惠券',
									url: ''
								},
								{
									img: 'https://desk-fd.zol-img.com.cn/t_s960x600c5/g2/M00/0A/05/ChMlWV7MdoWIechYAEXkfmcSAKcAAPeggE6JV8AReSW652.jpg',
									word: '直播',
									url: ''
								},
								{
									img: 'https://desk-fd.zol-img.com.cn/t_s960x600c5/g2/M00/0A/0E/ChMlWV7Nzg2If000AByhT0w4e8UAAPg0ALUWfIAHKFn587.jpg',
									word: 'WIFI',
									url: ''
								},
								{
									img: 'https://desk-fd.zol-img.com.cn/t_s960x600c5/g2/M00/0A/0E/ChMlWl7NzimIFerVABaZNqnndAYAAPg0gMjhM4AFplO448.jpg',
									word: '按钮',
									url: ''
								},
								{
									img:
										'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1598878321041&di=787f0e04f1c92c755e8c0551fcbff463&imgtype=0&src=http%3A%2F%2Fbpic.588ku.com%2Fback_pic%2F04%2F68%2F43%2F8758807d9375e84.jpg',
									word: '按钮',
									url: ''
								},
								{
									img: 'http://bpic.588ku.com//back_origin_min_pic/19/04/16/2eab67cb2c470d54c74cbb91268c77b0.jpg!/fw/750/quality/99/unsharp/true/compress/true',
									word: '按钮',
									url: ''
								},
								{
									img: 'http://bpic.588ku.com//back_origin_min_pic/19/04/16/6dba9129a0afa57d272fc98f6a2acca5.jpg!/fw/750/quality/99/unsharp/true/compress/true',
									word: '按钮',
									url: ''
								},
								{
									img: 'https://desk-fd.zol-img.com.cn/t_s960x600c5/g3/M09/0C/02/ChMlV17yBSWISHDdAEzI9S16J58AAVKfgF4BVcATMkN842.jpg',
									word: '按钮',
									url: ''
								},
								{
									img: 'https://desk-fd.zol-img.com.cn/t_s960x600c5/g2/M00/0A/05/ChMlWV7MdoWIechYAEXkfmcSAKcAAPeggE6JV8AReSW652.jpg',
									word: '按钮',
									url: ''
								}
							]
						}
					},
					{
						title: '标题栏',
						name: 'titles',
						styles: {
							marginTop: 0,
							marginBottom: 0,
							marginLeft: 0,
							marginRight: 0,
							wordStatus: 'center',
							circle: 0,
							colorBg: '#fff',
							upLoad1: {
								text: '标题栏',
								img: '',
								url: '',
								colorWord: '#212121'
							},
							upLoad2: {
								text: '',
								img: '',
								url: '',
								colorWord: '#969696'
							}
						}
					},
					{
						title: '辅组线',
						name: 'lines',
						styles: {
							type: 3,
							colorBg: '#B6F6B1',
							height: 1,
							marginTB: 5
						}
					},
					{
						title: '图片轮播',
						name: 'picLunbo',
						styles: {
							marginTop: 6,
							marginBottom: 6,
							marginLeft: 0,
							marginRight: 0,
							circle: 10,
							imgUrl: [
								{
									img: 'http://bpic.588ku.com//back_origin_min_pic/19/04/16/2eab67cb2c470d54c74cbb91268c77b0.jpg!/fw/750/quality/99/unsharp/true/compress/true',
									url: ''
								},
								{
									img: 'http://bpic.588ku.com//back_origin_min_pic/19/04/16/6dba9129a0afa57d272fc98f6a2acca5.jpg!/fw/750/quality/99/unsharp/true/compress/true',
									url: ''
								}
							],
							marginLR: 10
						}
					},
					{
						title: '更多门店',
						name: 'storeMessage',
						styles: {
							marginTop: 5,
							marginBottom: 6,
							marginRight: 0,
							marginLeft: 0
						}
					},
					{ title: '富文本', name: 'book', styles: { html: '我是', colorBg: '#fff', marginTop: 20, marginBottom: 20, marginLeft: 20, marginRight: 20, circle: 20 } },
					{
						title: '选项卡',
						name: 'card',
						styles: {
							colorBg: '#fff',
							colorWord: '#999',
							colorSelect: '#2D8CF0',
							marginTop: 0,
							marginLeft: 0,
							marginRight: 40,
							cardList: [{ name: '招聘信息' }, { name: '最新商家' }, { name: '最新资讯' }, { name: '黄页' }]
						}
					}
				],
	
			
			
			
				
			];
			uni.setStorage({
				key: 'LIST',
				data: data
			});
		}
	}
};
</script>

<style lang="scss">
@import '~@/static/styles/app.scss';
@import '/static/iconfont/iconfont.css';
img {
	width: 100%;
	height: 100%;
}
image {
	width: 100%;
	height: 100%;
}
</style>
